package org.colcon.web.client;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import org.colcon.web.model.framework.IContainer;
import org.colcon.web.model.framework.IItem;
import org.colcon.web.model.parsers.CLIParser;
import org.colcon.web.server.CLI;
import org.colcon.web.server.Model;

public class Tester 
{
	public static void main(String[] args) throws IOException, InterruptedException 
	{
		IItem item = CLIParser.parseItem("-type colcon -id colcon -children {users groups news}");
		
		for(String str : ((IContainer)item).getChildren())
			System.out.println(str);
		
		System.out.println(item);
		
		Model.init();
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		//System.out.print("> ");
		String input = reader.readLine();
		
		while(input != null)
		{
			String output = CLI.execute(input);
			
			System.out.println(output);
			
			//System.out.print("> ");
			input = reader.readLine();
		}
	}
}
